﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Cosmetic.Logic;
using Cosmetic.DataEntity;
using System.Collections.Generic;

public partial class PopTag : System.Web.UI.UserControl
{
	private TagManager m_TagManager		= new TagManager();

	public int MaxCount { get; set; }

	protected void Page_Load(object sender, EventArgs e)
	{
		if (!IsPostBack)
		{
			this.LoadPopTag();
		}
	}

	private void LoadPopTag()
	{
		List<Tag> theTagList	= this.m_TagManager.GetAllByCategory(TagManager.ETagCategory.Product).OrderByDescending(theTag=>theTag.LastUseTime).Take(20).ToList();
		if (theTagList.Count > 0)
		{
			this.MaxCount			= this.m_TagManager.GetAllByCategory(TagManager.ETagCategory.Product).Max(theTag=>theTag.Counts);
			this.rptTag.DataSource	= theTagList;
			this.rptTag.DataBind();
		}

	}
}
